home *** CD-ROM | disk | FTP | other *** search
/ ETO Development Tools 1 / ETO Development Tools 1.iso / Essentials / MacApp Documentation / MacApp AppleLink Messages / MacApp.Tech$ 12⁄8⁄89 / 0173-TTEView vs Interface-Dec89 < prev    next >
Encoding:
Text File  |  1989-12-08  |  4.1 KB  |  126 lines  |  [TEXT/GEOL]

  1. Item    1252069                         7-Dec-89        02:50
  2.  
  3. From:   D5295                           Reseach SW Design, D Goldman,PRT
  4.  
  5. To:     MACAPP.TECH$                    MacApp Technical
  6.  
  7. Sub:    TTEView vs Interface Guides..
  8.  
  9.    --> Usual caveats and abject apologies from brand-new MacApp'er <--
  10.  
  11. Since last week I've been subclassing TTEView to implement the Human Interface
  12. Guidelines (shift-arrow, command-arrow, option-arrow, shift-etc-arrow,
  13. intelligent definition of "word", intelligent cut & paste, etc, etc). I'm not
  14. completely done yet, but I do have a few observations:
  15.  
  16. 1) Controversy starter: Shouldn't all of this already be handled by TTEView???
  17.  
  18. 2) Shouldn't TTEView.Fields (and TTE*Command.Fields) be {IFC qDebug}'ed?
  19.  
  20. 3) A bug seems to arise with styled TTEViews, which I think is coming from
  21. TextEdit. Specifically, if the insertion point is located somewhere within the
  22. first line of the text, then an up-arrow is supposed to move the insertion
  23. point to the beginning of the line. It (at least on my SE/30, 6.0.3) doesn't.
  24. Once you notice this, it's not hard to put in a little work-around in
  25. DoKeyCommand.
  26.  
  27. 4) AutoScrollTEView incorrectly assumes that the TTEView is a direct subview of
  28. its scroller. I've got a bunch of TTEViews inside a TDialogView inside a
  29. TScroller (which is itself inside a TControl inside another TDialogView inside
  30. a TWindow). (Trust me.) Anyway, if you drag the mouse from such a TTEView out
  31. beyond the window, the view scrolls and scrolls until (a) the TTEView is out of
  32. sight, and then (b) AssumeFocus fails when AutoScrollTEView calls QDToViewPt.
  33.  
  34. Here's my fix. Since I've only been programming MacApp (or Mac!) for a couple
  35. of weeks, there are probably things I've done wrong; but it seems to work now:
  36.  
  37.  
  38. FUNCTION AutoscrollTEView: BOOLEAN;
  39.  
  40.    VAR
  41.    msePt:  Point;
  42.    viewPt: VPoint;
  43.    visRect:Rect;
  44.    delta:  VPoint;
  45.    vhs:VHSelect;
  46.    lead:   INTEGER;
  47.    trail:  INTEGER;
  48.    itsDown:BOOLEAN;
  49.    scroller:   TScroller;
  50.    locInScroller:  VPoint; {added by DWG, 12/6/89}
  51.    aView:  TView;  {ditto}
  52.  
  53.    BEGIN
  54.    GetMouse(msePt);
  55.    itsDown := StillDown;
  56.    IF itsDown & (pCurrTEView <> NIL) THEN
  57.    BEGIN
  58.    scroller := pCurrTEView.GetScroller(false);
  59.    IF scroller <> NIL THEN
  60.    IF (scroller.fScrollBars[h] <> NIL) | (scroller.fScrollBars[v] <> NIL) THEN
  61.    BEGIN
  62.    pCurrTEView.QDToViewPt(msePt, viewPt);
  63.    {   pCurrTEView.GetVisibleRect(visRect);}
  64.  
  65. {added by DWG, 12/6/89:}   {-----------}
  66.  
  67.    aView := pCurrTEView;
  68.    locInScroller := pCurrTEView.fLocation;
  69.    while aView.fSuperView <> scroller do
  70.    BEGIN
  71.    aView.LocalToSuper(viewPt);
  72.    aView := aView.fSuperView;
  73.    aView.LocalToSuper(locInScroller);
  74.    END;
  75.    if (aView <> pCurrTEView) & aView.Focus then;
  76.    aView.GetVisibleRect(visRect);
  77.  
  78.    {-----------}
  79.  
  80.    scroller.AutoScroll(viewPt, delta);
  81.  
  82.    FOR vhs := v TO h DO
  83.    BEGIN
  84.    {   lead := pCurrTEView.fLocation.vh[vhs] - visRect.topLeft.vh[vhs];}
  85.    lead := locInScroller.vh[vhs] - visRect.topLeft.vh[vhs];
  86.    {   trail := pCurrTEView.fLocation.vh[vhs] + pCurrTEView.fSize.vh[vhs] -}
  87.    trail := locInScroller.vh[vhs] + pCurrTEView.fSize.vh[vhs] -
  88.     visRect.botRight.vh[vhs];
  89.  
  90.    IF delta.vh[vhs] < 0 THEN
  91.    delta.vh[vhs] := Min(MAX(delta.vh[vhs], lead), 0)
  92.    ELSE
  93.    delta.vh[vhs] := MAX(Min(delta.vh[vhs], trail), 0);
  94.    END;
  95.    { The intent of the above is not to do autoscrolling that would scroll
  96.      beyond the subview boundary in any direction }
  97.  
  98.    IF (delta.v <> 0) | (delta.h <> 0) THEN
  99.    BEGIN
  100.    scroller.ScrollBy(delta.h, delta.v, TRUE);
  101.    pAutoScrolled := TRUE;
  102.  
  103.    { includes a frame Update, which could change lots of things, thus
  104.      requiring us, tiresomely, to take some or all of the following
  105.      restorative precautions: }
  106.  
  107.    IF pCurrTEView.Focus THEN
  108.    pCurrTEView.ClipFurtherTo(pCurrTEView.fHTE^^.destRect, 0, 0);
  109.    END
  110.    else{added by DWG, 12/6/89:}
  111.    if (aView <> pCurrTEView) & pCurrTEView.Focus then;
  112.    END;
  113.    END;
  114.    AutoscrollTEView := TRUE;
  115.    END;
  116.  
  117.  
  118. (Yuck! What happened to the tabs???) (Yes, I'm also new to AppleLink.)
  119.  
  120.  
  121. Anyhow, I just thought somebody might be interested...
  122.  
  123.  
  124. -- Dave Goldman
  125.  
  126.